/*
 * @Author: 张久冬
 * @Date: 2021-12-22 10:13:47
 * @
# Description:
 */
import JDRequest from '../index'
import { IdataType } from '@/service/type'
import type { IaccountType, IloginResult } from './type'
enum LoginAPI {
  AccountLogin = '/login',
  LoginUserInfo = '/users/',
  Usermenus = '/role/'
}

export function accountLoginRequest(account: IaccountType) {
  return JDRequest.post<IdataType<IloginResult>>({
    url: LoginAPI.AccountLogin,
    data: account,
    showLoading: true
  })
}
export function requestUserInfoByid(id: number) {
  return JDRequest.get<IdataType<any>>({
    url: `${LoginAPI.LoginUserInfo}${id}`
  })
}
export function requestUserMenusByRoleid(id: number) {
  return JDRequest.get<IdataType<any>>({
    url: `${LoginAPI.Usermenus}${id}/menu`
  })
}
